package com.note.common.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.note.common.constants.TCNameConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.sql.Date;

/**
 * @Package：com.note.common.domain
 * @Name：Log
 * @Author：热伊木
 * @Email：uyevan@163.com
 * @Date：2024-05-01-8:24
 * @Description：系统日志试题模型
 */
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Entity(name = TCNameConstants.LOG)
@TableName(TCNameConstants.LOG)
@Schema(description = "系统日志模型")
public class Log implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    @Schema(description = "唯一ID")
    private Integer id;

    @Column(name = "opt_name")
    @Schema(description = "操作用户名")
    private String optName;

    @Column(name = "log_type")
    @Schema(description = "操作类型")
    private String logType;

    @Column(name = "log_message")
    @Schema(description = "日志信息")
    private String logMessage;

    @Column(name = "create_time")
    @TableField(fill = FieldFill.INSERT) /*当前时间*/
    @Schema(description = "创建时间")
    private Date createTime;

    @Column(name = "ip_address")
    @Schema(description = "用户IP地址")
    private String ipAddress;

    @Column(name = "request_method")
    @Schema(description = "请求方法")
    private String requestMethod;

    @Column(name = "request_url")
    @Schema(description = "请求URL")
    private String requestUrl;

    @Column(name = "response_code")
    @Schema(description = "响应状态码")
    private Integer responseCode;

    @Column(name = "response_message")
    @Schema(description = "响应消息")
    private String responseMessage;

    @Column(name = "additional_data")
    @Schema(description = "附加数据")
    private String additionalData;
}